<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
    <changeSet author="unsomen" id="create_table_users" objectQuotingStrategy="LEGACY">
        <preConditions onError="HALT" onFail="MARK_RAN" onSqlOutput="IGNORE">
            <not>
                <tableExists tableName="users"/>
            </not>
        </preConditions>
        <createTable tableName="users">
            <column autoIncrement="true" name="id" type="BIGSERIAL">
                <constraints nullable="false" primaryKey="true"/>
            </column>
            <column name="name" type="VARCHAR(255)">
                <constraints nullable="false" unique="true"/>
            </column>
        </createTable>
    </changeSet>
    <changeSet author="unsomen" id="create_table_comments" objectQuotingStrategy="LEGACY">
        <preConditions onError="HALT" onFail="MARK_RAN" onSqlOutput="IGNORE">
            <not>
                <tableExists tableName="comments"/>
            </not>
        </preConditions>
        <createTable tableName="comments">
            <column autoIncrement="true" name="id" type="BIGSERIAL">
                <constraints nullable="false" primaryKey="true"/>
            </column>
            <column name="author_id" type="BIGINT">
                <constraints nullable="false"/>
            </column>
            <column name="create_time" type="TIMESTAMP WITHOUT TIME ZONE" />
            <column name="text" type="LONGTEXT">
                <constraints nullable="false"/>
            </column>
        </createTable>
    </changeSet>
</databaseChangeLog>
